package com.yjq.client.controller;

import com.seventh.common.pojo.R;
import com.yjq.client.poji.entry.TbClient;
import com.yjq.client.poji.vo.ClientVo;
import com.yjq.client.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-seventh
 * @description: Client的控制层
 * @author: 杨佳琪
 * @create: 2021-07-23 11:37
 **/
@RestController
@RequestMapping("client/cli")
public class ClientController {
    @Resource
    private ClientService clientService;

    @PostMapping("initClientTable/{currentPage}/{pageSize}")
    public R initClientTable(@PathVariable("currentPage") Integer currentPage, @PathVariable("pageSize") Integer pageSize,
                             @RequestBody ClientVo clientVo){
        return clientService.findAllClientByPage(currentPage,pageSize,clientVo);
    }

    @DeleteMapping("deleteClient/{id}")
    public R deleteClient(@PathVariable Integer id){
        return clientService.deleteClient(id);
    }

    @PutMapping("updateClient")
    public R updateClient(TbClient tbClient){
        return clientService.updateClient(tbClient);
    }


    @PostMapping("insertClient")
    public R insertClient(TbClient tbClient){
        /*clientService.insertClient(tbClient);*/
        return clientService.insertClient(tbClient);
    }
}



